//
//  UIButton+Extension.swift
//  MyBlog
//
//  Created by User on 16/4/7.
//  Copyright © 2016年 personal. All rights reserved.
//

import UIKit

extension UIButton{

    convenience init(imageName: String, backImageName: String){
        
        self.init()
        
        setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        setImage(UIImage(named: imageName + "_highlighted"), forState: UIControlState.Highlighted)
        setBackgroundImage(UIImage(named: backImageName), forState: UIControlState.Normal)
        setBackgroundImage(UIImage(named: backImageName + "_highlighted"), forState: UIControlState.Highlighted)
        sizeToFit()
    }
    
    convenience init(title: String, color:UIColor, backImageName:String){
        self.init();
        
        setTitle(title, forState: UIControlState.Normal)
        setTitleColor(color, forState: UIControlState.Normal)
        setBackgroundImage(UIImage(named: backImageName), forState: UIControlState.Normal)
       

    
    
    }
    
}